package edu.iss.demo.web.controller;

import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

import edu.iss.demo.model.UserDetail;

@Controller
public class NavigationController {

	@RequestMapping(value={"/", "index"}, method=RequestMethod.GET)
	public ModelAndView index() {
		
		
		ModelAndView mav = new ModelAndView("Login");
		mav.addObject("userDetail", new UserDetail());
		
		return mav;
	}
	
	
	@RequestMapping(value={"/logout"}, method=RequestMethod.GET)
	public ModelAndView logout(HttpServletRequest r) {
		
		
		r.getSession().setAttribute("userDetails", null);
		ModelAndView mav = new ModelAndView("Logout");
		mav.addObject("userDetail", new UserDetail());
		
		return mav;
	}
	
	
	
}
